using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;
using SystemFramework.Util;

namespace TF.Access {
	public partial class TF_EventDetail {

        private string toCityName;

        public string ToCityName
        {
            get
            {
                return toCityName;
            }
            set
            {
                toCityName = value;
            }
        }
		
		#region Methods
		
		/// <summary>
		/// Selects a single record from the TF_EventDetail table.
		/// </summary>
        public static List<TF_EventDetail> SelectByEhId(int ehId)
        {
            List<TF_EventDetail> tF_EventDetailList = new List<TF_EventDetail>();
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_EventDetailSelectByEhId", ehId))
            {
                while (dataReader.Read())
                {
                    TF_EventDetail tF_EventDetail = MakeTF_EventDetail(dataReader);
                    tF_EventDetail.toCityName = ConvertHelper.GetString(dataReader["ToCityName"], string.Empty);
                    tF_EventDetailList.Add(tF_EventDetail);
                }
            }

            return tF_EventDetailList;
        }

        public static bool DeleteEdAndEvs(int edId, int ownerId)
        {
            bool ret = false;
            try
            {
                SqlClientUtility.ExecuteNonQuery("TF_DeleteEdAndEvs", edId, ownerId);
                ret = true;
            }
            catch
            {
                ret = false;
            }

            return ret;
        }

        public static bool DeleteEventDetailByDayNum(int dayNumber, int ownerId)
        {
            bool ret = false;
            try
            {
                SqlClientUtility.ExecuteNonQuery("TF_DeleteEventDetailByDayNum", dayNumber, ownerId);
                ret = true;
            }
            catch
            {
                ret = false;
            }

            return ret;
        }

		#endregion
	}
}
